<template>
   <div class="course-item">
      
        <div class="course-div detail">
            <router-link tag="div" :to='to' v-if="to">

                <p class="course-title"  >
                    <level :level="item.level"/>
                    <span class="class-name">{{item.classAliasName || item.className}}</span>
                 
                    <em class="season">({{item.periodName}})</em>
                </p>
            </router-link>
            <div v-else>
                 <p class="course-title"  >
                    <level :level="item.level"/>
                    <span class="class-name">{{item.classAliasName || item.className}}</span>
                   
                    <em class="season">({{item.periodName}})</em>
                </p>
            </div>
            <div class="course-div">
                <p class="course-mes day">
                    <img src="../../assets/img/home/calendar.png" />
                    <span>{{item.startCourseTime | formatDate('MM月DD日')}}</span>
                </p>
                <p class="course-mes">
                    <img src="../../assets/img/home/clock.png" />
                    <span>{{item.timeInterval}}  {{item.studyingTime}}</span>
                </p>
                <p v-if="item.campusAddress" class="course-mes address">
                    <img src="../../assets/img/home/location.png" />
                    <span>{{item.campusAddress}}</span>
                </p>
                <div class="money-frame">
                    <div class="money">
                        <em>￥</em>{{ item.studyingFee | formatDatas}}
                    </div>
                    <div class="number" v-if="!noCar">
                        <span v-if="item.quota - item.regAmount>0&&item.quota - item.regAmount<=3">余<em>{{item.quota - item.regAmount}}</em>学位</span>
                        <span v-else>{{(item.quota - item.regAmount)?(item.quota - item.regAmount)<15?'学位紧缺':'火热报名中':'学位已满'}}</span>
                      
                    </div>
                </div>
            </div>

            <div class="course-status">
                <img class="headImg" :src="item.avatarUrl ? item.avatarUrl.split(',')[0]+'?imageMogr2/thumbnail/500x' :teacherDefault" />
              
                <img class="diamond" src="../../assets/img/zhuan.png" />
                {{item.teacherName}}

                <div v-if="type==='mineCourse'">
                    <span v-if="item.progressStatus==='2'" class="class-status">
                        已结课
                    </span>
                

                </div>
               
                    <div class="no-status" v-if="noCar">
                        <span v-if="item.quota - item.regAmount>0&&item.quota - item.regAmount<=3">余<em>{{item.quota - item.regAmount}}</em>学位</span>
                        <span v-else>{{(item.quota - item.regAmount)?(item.quota - item.regAmount)<15?'学位紧缺':'火热报名中':'学位已满'}}</span>
                    </div>
            </div>
            <!-- <div v-if="type!='mineCourse'&&!noCar">
                <div class="car-div"  @click.stop.prevent="addToCart(item.classId)">
                    <img src="../../assets/img/home/select.png"/>
                </div>
            </div> -->
        </div>
    </div>
</template>

<script>
import teacherDefault from '../../assets/img/teacher_def.png'
import api from 'util/xhr'
import global from 'util/global'
import Level from './Level.vue'

export default {
  components: {
    Level
  },
  props: ['item', 'type', 'hasAddress', 'isRecommend', 'to', 'noCar'],
  data() {
    return {
      backUrl: document.location.href,
      isD11: global.isD11(),
      teacherDefault,
      ShowClassPermit: false,
      regId: '',
    }
  },
  methods: {
    stopPr(e) {
      e.stopPropagation()
    }
  },
  mounted() {}
}
</script>


<style scoped lang="less">
@images: '../../assets/img';
.course-item {
  width: 100%;
  position: relative;
  background: white;
  border-bottom: 2px solid #f2f2f2;
  .show-box {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;

    .show-div {
      width: 636px;
      height: 896px;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translateX(-50%) translateY(-50%);
      background: transparent;
      img {
        width: 636px;

        display: block;
      }
    }
  }
}
.no-status {
  float: right;
  span {
    em {
      font-style: normal;
      font-weight: bold;
      color: #ff544c;
    }
  }
}
.car-div {
  display: inline-block;
  position: absolute;
  right: 0;
  bottom: 0;
  font-size: 0;
}
.car-div img {
  width: 85px;
}
.course-div {
  display: inline-block;
  font-size: 24px;
  color: #646464;
  width: 100%;
  position: relative;
}
.money-frame {
  position: absolute;
  right: 0;
  bottom: 0;
  text-align: right;
  .money {
    font-size: 40px;
    color: #ff544c;
    font-weight: 500;
    em {
      font-size: 24px;
      color: #ff544c;
      font-weight: bold;
    }
  }
  .number {
    color: #666;
    font-size: 24px;
    span {
      em {
        font-style: normal;
        font-weight: bold;
        color: #ff544c;
      }
    }
  }
}
.course-div.detail {
  overflow: hidden;
  width: 100%;
  padding: 30px 25px 0 25px;
  box-sizing: border-box;
}
.course-div.head {
  width: 200px;
  text-align: center;
  position: relative;
}
.headImg {
  width: 67px;
  height: 67px;
  border-radius: 67px;
  border: 2px solid #eee;
  vertical-align: middle;
  /*margin-left: 3rem;*/
}
.course-div.head p {
  width: 200px;
}
.diamond {
  position: relative;
  top: 20px;
  left: -20px;
  width: 26px;
}
.zhongchou {
  position: absolute;
  top: 0;
  right: 30px;
  width: 52px;
}
.hui11 {
  width: 100px;
  height: 71px;
}
.recommend {
  position: absolute;
  top: 0;
  right: 0;
  width: 78px;
}
.course-title {
  font-size: 28px;
  color: #333333;
  margin-bottom: 23px;
  padding-top: 4px;
  line-height: 38px;
}
.course-title .course-tag {
  width: 68px;
  height: 40px;
  line-height: 34px;
  font-size: 24px;
  color: #fff;
  text-align: center;
  background: url('@{images}/home/grade.png') no-repeat;
  background-size: 100%;
  float: left;
  margin-right: 5px;
  margin-top: 2px;
}
.course-title .class-name {
  font-size: 36px;
}
.course-title span {
  display: inline-block;
  max-width: 500px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.course-title em {
  font-size: 28px;
  vertical-align: middle;
  margin-left: 10px;
}
.season {
  /* background: #ff7700; */
  color: #333 !important;
  border-radius: 8px !important;
  font-size: 30px !important;
  padding: 0 4px !important;
}
.course-mes {
  font-size: 24px;
  line-height: 24px;
  height: 24px;
  margin-top: 19px;
  &:first-child {
    margin-top: 0;
  }
}

.course-mes.day {
}
.course-mes span {
  vertical-align: top;
  position: relative;
  top: 2px;
  margin-left: 6px;
}
.course-mes img {
  width: 24px;
}
.course-mes.address span {
  width: 380px;
  overflow: hidden;
  display: inline-block;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.course-status {
  /* margin-top: 1rem; */
  height: 100px;
  line-height: 100px;
  /* border-top: 2px dashed #f2f2f2; */
  color: #777 !important;
  font-size: 28px;
}
.course-status .number em {
  color: #ff6600 !important;
}
.course-status .course-rest {
  margin-left: 20px;
}
.course-status .money {
  color: #ff6600;
  font-size: 30px;
  float: right;
  clear: both;
  position: relative;
  right: 30px;
  font-weight: bold;
}
.money em {
  color: #999999;
  font-weight: normal;
  font-size: 24px;
}
.class-status {
  color: #666;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 24px;
  float: right;
}
.class-status.wei {
  /* background: #47c2c9; */
  width: 158px;
  height: 48px;
  border-radius: 24px;
  color: #fff;
  padding: 0;
  text-align: center;
  font-size: 24px;
  line-height: 48px;
  background-color: #ad7bde;
  margin-top: 36px;
}
.class-status.yi {
  /* background: #ff9000; */
  color: #3271f1;
}
</style>
